extends "../../azurlane_ctrl/AzurItem.gd"
func init():
	.init()
	name = "[稀有]可塑性机械臂"
	info = "造成技能伤害时，临时偷取目标5点三攻属性，同一个目标最多偷取20次(每秒最多触发3次)\n[color=#DC143C]同时装备两件时可升级[/color]"
	price = 300
	att.airL = 0.1
	att.atkL = 0.1
	att.mgiAtkL = 0.1

var index = 0
func _upS():
	index = 0

func _connect():
	._connect()
	masCha.connect("onAtkInfo", self, "onAtkInfo")
	sys.main.connect("onBattleStart", self, "start")

func onAtkInfo(atkInfo):
	if atkInfo.atkType == sys.AtkType.SKILL and index <= 3:
		index += 1
		var bf = atkInfo.hitCha.hasBuff("b_adjustableArm")
		if bf == null:
			bf = masCha.castBuff(atkInfo.hitCha, b_adjustableArm.new())
		bf.inCr()
		
func start():
	if masCha != null:
		masCha.addBuff(b_adjustableArm2.new())

class b_adjustableArm:
	extends "../../azurlane_ctrl/AzurBuff.gd"
	var p = 5
	func _init():
		attInit()
		id = "b_adjustableArm"
		dispel = 2
	func inCr():
		var bf = casCha.hasBuff("b_adjustableArm2")
		if bf == null:return
		if masCha.att.atk > 0 and att.atk > -60:
			att.atk -= p
			bf.att.atk += p
		if masCha.att.mgiAtk > 0 and att.mgiAtk > -60:
			att.mgiAtk -= p
			bf.att.mgiAtk += p
		if masCha.att.air > 0 and att.air > -60:
			att.air -= p
			bf.att.air += p

class b_adjustableArm2:
	extends "../../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_adjustableArm2"
		dispel = 2

func upgrade():
	name = "[color=#FFFF00][史诗]可塑性机械臂"
	info = "造成技能伤害时，临时偷取目标5点三攻属性，同一个目标最多偷取20次(每秒最多触发3次)"
	att.airL = 0.2
	att.atkL = 0.2
	att.mgiAtkL = 0.2

